#include "writethread.h"
#include <QDebug>
#include <QWriteLocker>

WriteThread::WriteThread(QReadWriteLock *lock)
    :QThread()
    ,readWriteLock(lock)
{

}

void WriteThread::run()
{
    qDebug() << QStringLiteral("写线程进来了：")<<"thread id ="
    <<QThread::currentThreadId();
    while (!stop) {
        QWriteLocker lock(readWriteLock);
        qDebug() << "thread id =" <<QThread::currentThreadId()
                 <<QStringLiteral("开始写");
        QThread::sleep(2);
        qDebug() << "thread id =" <<QThread::currentThreadId()
                 <<QStringLiteral("写完了");
        QThread::msleep(100);

    }


}
